import java.util.Scanner;

public class QQQ {
    public static void main(String[] args){
        int[] a ;
        a=new int[6];
        for(int i=0;i<6;i++) {
            Scanner A = new Scanner(System.in);
            a[i] = A.nextInt();
        }
            int sum=0;
            int max=a[1];
            int min=a[1];
            for(int o=0;o<6;o++) {
                sum+=a[o];
                if (a[o] >max) {
                    max = a[o];
                }
                if (a[o]<min) {
                    min = a[o];
                }

            }
              System.out.println((sum-max-min)/4);
        }
    }

